home *** CD-ROM | disk | FTP | other *** search
/ 1,000+ Great Games / 1_1000 Games.iso / DOSGAMES / POLYINIT.ZIP / SINCOS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-28  |  476 b   |  29 lines

  1. #include <conio.h>
  2. #include <stdio.h>
  3. #include <dos.h>
  4. #include <math.h>
  5.  
  6. int valloc( unsigned long size );
  7. long far *SIN, *COS;
  8.  
  9. void InitSinCos(void)
  10. // Setup Sine and cosine tables.
  11. {   float A;
  12.     int a;
  13.  
  14.     a=valloc(2048);
  15.     SIN=(long far *)MK_FP( a, 0 );
  16.     a=valloc(2048);
  17.     COS=(long far *)MK_FP( a, 0 );
  18.  
  19.     for ( a=0; a<256; a++ )
  20.     {
  21.         A=(float)a;
  22.         A=A/256;
  23.         A=A*2*M_PI;
  24.         SIN[a]=(long)(sin(A)*0x10000L);
  25.         COS[a]=(long)(cos(A)*0x10000L);
  26.     };
  27. }
  28.  
  29.